package com.dingreading.cloud.gateway.service.impl;

import com.dingreading.cloud.gateway.entity.table.MembersTableDef;
import com.mybatisflex.core.query.QueryCondition;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.dingreading.cloud.gateway.entity.Members;
import com.dingreading.cloud.gateway.mapper.MembersMapper;
import com.dingreading.cloud.gateway.service.MembersService;
import org.springframework.stereotype.Service;

/**
 *  服务层实现。
 *
 * @author EDY
 * @since 2025-10-31
 */
@Service
public class MembersServiceImpl extends BaseServiceImpl<MembersMapper, Members, MembersTableDef> implements MembersService {
    @Override
    protected MembersTableDef getTable() {
        return MembersTableDef.members;
    }

    @Override
    public Members getByStudentUid(String studentUid, String agencyUid) {
        QueryCondition condition = QueryCondition.createEmpty()
                .and(table.corpUid.eq(agencyUid))
                .and(table.uid.eq(studentUid));
        return getMapper().selectOneByCondition(condition);
    }
}
